<template>
  <div>
    <elm-page-tb style="width: calc(100% - 1px);height: calc(100% - 1px)" :splite="false" :splite-show="false">
      <template #top>
        <el-date-picker type="date" value-format="yyyy-MM-dd" size="mini" style="width:250px;" v-model="postData.date" clearable></el-date-picker>
        <right>
          <el-button-group>
            <el-button icon="el-icon-search" size="mini" @click="loadData()">查询</el-button>
          </el-button-group>
        </right>
      </template>
      <elm-table :data="tableData" :post-data="postData" @row-click="rowClick" :page-size="9999">
        <el-table-column prop="pj_mc" label="项目名称" align="left" header-align="center"></el-table-column>
        <el-table-column prop="work" label="工作内容" align="left" header-align="center" ></el-table-column>
        <el-table-column prop="create_user_mc" label="提交人" align="center" width="100"></el-table-column>
        <el-table-column prop="remark" label="备注" align="left" header-align="center"></el-table-column>
      </elm-table>
      <elm-open-button url="daily_edit" title="新增" width="800" height="50%" :data="{ model:subData }" type="text" ref="button" v-show="false"></elm-open-button>
    </elm-page-tb>
  </div>
</template>

<script>
export default {
  extends: elmVueBase,
  data() {
    return {
      postData: { date: new Date().toISOString().split('T')[0]},
      tableData:[],
      subData:{},
    }
  },
  async created() {
    await this.loadData();
  },
  destroyed() {
    this.request.callVue.tablebinding();
  },
  methods: {
    async loadData(){
      let res0= await elm.post("/business/hrm/daily/GetTaskData",this.postData);
      let res1= await elm.post("/business/hrm/daily/GetRwzpData",this.postData);
      this.tableData=[...res0,...res1];
      this.tablebinding();
    },
    rowClick(row) {
      this.subData=row;
      this.subData.create_date=new Date().toISOString().split('T')[0];
      this.$nextTick(() => {
        this.$refs.button.$el.click();
      });
    },
  }
}
</script>
